package code1.dp;

import java.util.Arrays;

/**
 * 原题链接：https://leetcode.cn/problems/longest-continuous-increasing-subsequence/description/
 */
public class P674 {

    //最长连续递增子序列
    //dp[i]表示以nums[i]为结尾的连续递增子序列的长度
    //dp[i]=dp[i-1]+1  (nums[i-1]<nums[i])
    public int findLengthOfLCIS(int[] nums) {
        int[] dp=new int[nums.length];
        Arrays.fill(dp,1);
        int ans=1;
        for(int i=1;i<nums.length;i++){
            if(nums[i]>nums[i-1]){
                dp[i]=dp[i-1]+1;
            }else{
                dp[i]=1;
            }
            ans=Math.max(ans,dp[i]);
        }
        return ans;
    }
}
